﻿package com.tudou.home.newskin.buttons
{
    import com.tudou.home.common.button.*;
    import com.tudou.home.common.utils.*;
    import flash.text.*;

    public class HrefIconText extends IconText
    {
        protected var css:StyleSheet;
        protected var hrefStr:String = "javascript:;";
        protected var hoverCssObj:Object;
        protected var cssObj:Object;
        protected var titleStr:String;

        public function HrefIconText(param1:Number)
        {
            super(param1);
            titleText.mouseEnabled = true;
            css = new StyleSheet();
            return;
        }// end function

        override public function set textFormat(param1:TextFormat) : void
        {
            super.textFormat = param1;
            param1.underline = false;
            cssObj = TextFormatStyleSheetUtil.toStyleSheet(param1);
            param1.underline = true;
            hoverCssObj = TextFormatStyleSheetUtil.toStyleSheet(param1);
            css.setStyle("a", cssObj);
            css.setStyle("a:hover", hoverCssObj);
            return;
        }// end function

        public function set href(param1:String) : void
        {
            hrefStr = param1;
            return;
        }// end function

        override public function set title(param1:String) : void
        {
            titleStr = param1;
            super.title = param1;
            return;
        }// end function

        override public function refresh() : void
        {
            super.refresh();
            titleText.defaultTextFormat = new TextFormat();
            titleStr = titleText.text;
            titleText.text = "";
            titleText.styleSheet = css;
            titleText.htmlText = "<a href=\'" + hrefStr + "\'>" + titleStr + "</a>";
            return;
        }// end function

    }
}
